<template>
    <div class="bj">
        <div class="orders">
            <!-- <h2>全部订单页面</h2> -->
            <!-- 订单信息页面 -->
            <h2>订单详情</h2>
            <div class="top">
                <span
                    >累计订单: <i>{{ myuser.orderStatusNum.order_count }}</i></span
                >
                &nbsp;
                <span
                    >总消费: <i>{{ myuser.orderStatusNum.sum_price }}</i></span
                >
            </div>

            <!-- 代付款五个部分 -->

            <ul class="cargo">
                <li :class="{ active: ordid == 1 }" @click="ordid = 1"><span> 待付款 </span> <i>0</i></li>
                <li :class="{ active: ordid == 2 }" @click="ordid = 2">
                    <span> 待发货 </span> <i>{{ dropShipping.length }}</i>
                </li>
                <li :class="{ active: ordid == 3 }" @click="ordid = 3"><span> 待收货 </span> <i>0</i></li>
                <li :class="{ active: ordid == 4 }" @click="ordid = 4"><span> 待评价 </span> <i>0</i></li>
                <li :class="{ active: ordid == 5 }" @click="ordid = 5"><span> 以完成 </span> <i>0</i></li>
            </ul>

            <!-- 内容 -->
            <ol class="content-item">
                <li v-if="1 == ordid"><img src="../../assets/image/noGood.png" alt="" /></li>
                <li v-if="2 == ordid">
                    <!-- 代发货页面 -->
                    <div class="drop" v-for="(item, index) in dropShipping" :key="item.title + index">
                        <div class="top">{{ item.time }}</div>
                        <div class="center">
                            <img :src="item.imgs" alt="" />
                            <h2>{{ item.title }}</h2>
                            <div>
                                <span>￥{{ item.price }}.00</span>
                                <i>x{{ item.count }}</i>
                            </div>
                        </div>
                        <h3 class="bottom">
                            共{{ item.count }}件商品,总金额 <i> ￥{{ item.price * item.count }}.00</i>
                        </h3>
                        <div class="look">
                            <router-link tag="span" :to="`/details/${item.id}`"> 查看详情</router-link>
                        </div>
                    </div>
                </li>
                <li v-if="3 == ordid"><img src="../../assets/image/noGood.png" alt="" /></li>
                <li v-if="4 == ordid"><img src="../../assets/image/noGood.png" alt="" /></li>
                <li v-if="5 == ordid"><img src="../../assets/image/noGood.png" alt="" /></li>
            </ol>
        </div>
    </div>
</template>

<script>
import { mapGetters, mapState } from "vuex";
export default {
    data() {
        return {
            ordid: 1,
        };
    },
    computed: {
        ...mapState(["dropShipping"]),
        ...mapGetters(["myuser"]),
    },
    created() {
        console.log(this.myuser);
        this.ordid = this.$route.params.ordid;
    },
};
</script>

<style lang="scss" scoped>
.bj {
    width: 100vw;
    height: 100vh;
    background: #f5f5f5;
}
.orders {
    height: 100px;
    background: #e93323;
    position: relative;
    padding: 28px 0px 0 10px;
    &::after {
        content: "";
        width: 61px;
        height: 59px;
        background: url("../../assets/image/orderTime.png") no-repeat center center / cover;
        position: absolute;
        right: 4%;
        top: 40%;
        transform: translate(0%, -50%);
    }
    h2 {
        font-size: 18px;
        color: #fff;
        font-weight: 700;
    }

    .top {
        display: flex;
        font-size: 14px;
        margin-top: 10px;
        color: rgb(218, 215, 215);
        i {
            font-size: 12px;
        }
    }

    // 货物的六个状态
    .cargo {
        display: flex;
        justify-content: space-around;
        align-items: center;
        background: #fff;
        text-align: center;
        width: 345px;
        font-size: 14px;
        height: 70px;
        // background: #fff;
        transform: translate(0%, 40%);
        // border: 1px solid red;
        border-radius: 2px !important;

        li {
            display: flex;
            flex-direction: column;
            position: relative;
            &.active::after {
                content: "";
                width: 45px;
                height: 2px;
                background: red;
                position: absolute;
                bottom: -42%;
            }
            i {
                margin-top: 8px;
            }
        }
    }
}
.content-item {
    margin-top: 30px;
    display: flex;
    overflow: hidden;
    flex-wrap: wrap;
    box-sizing: border-box;
    // width: 100vw;
    li {
        overflow: hidden;
        width: 357px;
        // border: 1px solid red;
    }
}
.drop {
    transform: translateY(-5px);
    background: #fff;
    width: 347px;
    padding: 0px 0 20px 0;
    border-radius: 2px;
    .top {
        line-height: 42px;
        text-align: center;
        background: #fff;
        color: black;
        margin: 10px;
        border-bottom: 1px solid rgba(191, 182, 182, 0.5);
    }
    .center {
        background: #fff;
        display: flex;
        justify-content: space-around;
        // align-items: center;
        font-size: 14px;
        img {
            width: 60px;
            height: 60px;
            border-radius: 12px;
        }
        h2 {
            width: 153px;
            height: 35px;
            color: rgb(57, 55, 55);
            font-size: 14px;
            font-weight: 500;
            // border: 1px solid red;
            line-height: 17px;

            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2; // 设置显⽰⼏⾏
            -webkit-box-orient: vertical;
        }
        div {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            color: gray;
            background: #fff;
            i {
                margin-top: 5px;
            }
        }
    }
    .bottom {
        // border: 1px solid red;
        width: 100%;
        background: #fff;
        text-align: right;
        font-size: 14px;
        margin-top: 10px;
        margin-bottom: 20px;

        i {
            color: red;
            font-weight: 700;
            background: #fff;
            margin-right: 10px;
        }
    }
    .look {
        background: #fff;
        height: 36.5px;
        border-top: 1px solid rgba(191, 182, 182, 0.5);
        position: relative;
        span {
            background: #e93323;
            color: #fff;
            font-size: 14px;
            width: 82px;
            line-height: 20px;
            text-align: center;
            padding: 5px 10px;
            border-radius: 15px;
            position: absolute;
            right: 3%;
            top: 50%;
            transform: translate(0, -25%);
        }
    }
}
</style>
